home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / lib / float / spa_modf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-09-09  |  592 b   |  37 lines

  1.  
  2. /*
  3.  *  SPA_MODF.C
  4.  *
  5.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  6.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  7.  *    DICE-LICENSE.TXT.
  8.  *
  9.  *  float frac = fmodf(float value, float *ip);
  10.  *
  11.  *  (converts to either _ffpmodf() or _spmodf()), this file converts
  12.  *  to _spmodf().
  13.  */
  14.  
  15. #ifdef _FFP_FLOAT
  16. #undef _FFP_FLOAT
  17. #endif
  18.  
  19. #ifndef _SP_FLOAT
  20. #define _SP_FLOAT
  21. #endif
  22.  
  23. #include <math.h>
  24.  
  25. float
  26. fmodf(value, ip)
  27. float value;
  28. float *ip;
  29. {
  30.     if (value >= 0.0)
  31.     *ip = ffloor(value);
  32.     else
  33.     *ip = fceil(value);
  34.     return(value - *ip);
  35. }
  36.  
  37.